import java.util.Vector;

class FuzzyClassSA{
    protected String name;    
    protected Vector<FuzzyRuleSA> v_rules;
    
    public FuzzyClassSA(String name){
	this.name = name;
	this.v_rules = new Vector();
    }
    
    public String getName(){return this.name;}
    public int numRules(){return this.v_rules.size();}
    public FuzzyRuleSA getRuleAt(int pos){return this.v_rules.elementAt(pos);}

    public void addRule(FuzzyRuleSA fr){this.v_rules.add(fr);}
    
    public float membershipValue(FuzzyObjectSA fo){
	float membership_class = 0;
	for(int j=0;j<this.v_rules.size();j++){
	    FuzzyRuleSA fr = this.v_rules.elementAt(j);
	    float tmp = fr.membershipValue(fo.getValues());
	    if(tmp > 0){
		RuleMembership rm = new RuleMembership(fr.getId(), tmp);
		fo.addRuleMembership(rm);
	    }

	    if(tmp > membership_class) 
		membership_class = tmp;
	    
	}//end for		
	return membership_class;
    }//end membershipValues
}//end class
